
#if 0 //set to 1 to enable this example

/**
 * @file app_logo_anim_example.c
 * @author 启凡科创
 * @brief more config in app_logo_anim.h
 * @version 1.0.0
 * @date 2025-02-26
 * 
 * @copyright Copyright (c) 2025
 * 
 */

#include "app_manager.h"
#include "lvgl.h"
#include "app_logo_anim.h"

static click_cb(lv_event_t *e)
{
    app_manager_open(0, "动画logo", (void *)LV_SCR_LOAD_ANIM_FADE_IN, 500, 0);
}

static void *create_ui(void *arg)
{
    lv_obj_t *scr = lv_obj_create(NULL);
    lv_obj_t *label = lv_label_create(scr);
    lv_label_set_text(label, "Hello world");
    lv_obj_center(label);
    lv_obj_add_flag(label, LV_OBJ_FLAG_CLICKABLE);
    lv_obj_add_event_cb(label, c_cb, LV_EVENT_CLICKED, NULL);
    return scr;
}

static void app_desktop_register()
{
    app_register_t cfg;
    app_manager_config_struct_init(&cfg);

    cfg.ui_type = APP_UI_HAVE;

    cfg.name = "桌面";
    cfg.create_ui = create_ui;
    app_manager_register_app(&cfg);
}

void app_manager_register()
{
    app_desktop_register();
    app_logo_anim_register();
}

static void app_load_ui(void *ui, void *anim, uint16_t time, uint16_t delay)
{
    lv_obj_t *scr = (lv_obj_t *)ui;
    lv_scr_load_anim_t load_anim = (lv_scr_load_anim_t)anim;
    lv_scr_load_anim(scr, load_anim, time, delay, 1);
}

void main()
{
    app_manager_ui_register_load_cb(app_load_ui); // 注册加载界面回调

    app_manager_init();

    app_manager_open(0, "动画logo", (void *)LV_SCR_LOAD_ANIM_FADE_IN, 0, 0);
}

#endif